package com.pcbly.web.components.license.validator;

import com.pcbly.web.components.license.License;
import com.pcbly.web.components.license.LicenseException;

public class EditionValidator implements Validator {
	private String requiredEdition;

	public EditionValidator(String requiredEdition) {
		this.requiredEdition = requiredEdition;
	}

	public void validate(License license) throws LicenseException {
		if (!requiredEdition.equals(license.getLicenseData().getEdition()))
			throw new LicenseException((new StringBuilder()).append("Edition ")
					.append(requiredEdition).append(" is required.").toString());
		else
			return;
	}

}
